<template>
  <div>
  {{news}}<br>{{advertising}}
    <table border="1px" cellspacing="0px" align="center">
      <tr>
        <td>标题</td>
        <td>内容</td>
      </tr>
      <tr  v-for="i in news">
        <td>{{i.title}}</td>
        <td>{{i.content}}</td>
      </tr>
    </table>
    <button v-for="i in newtpage" @click="get_new(i)">{{i}}</button>
    <br>
    <br>
    <table border="1px" cellspacing="0px" align="center">
      <tr>
        <td>图片</td>
        <td>跳转地址</td>
        <td>分类</td>
      </tr>
      <tr  v-for="i in advertising">
        <td>
          <img :src="'http://127.0.0.1:8000'+i.picture" alt="" width="50px" height="50px">
        </td>
        <td>
          <a :href="i.jumpaddress">{{ i.jumpaddress }}</a>
        </td>
        <td>{{i.cate}}</td>
      </tr>
    </table>
    <button v-for="i in ggtpage" @click="get_advertising(i)">{{i}}</button>
  </div>
</template>

<script>
export default {
  name: "day0101_newgg",
  data() {
    return {
      news:[],
      advertising:[],
      newtpage:[],
      ggtpage:[]
    }
  },
  methods: {
    get_new(i){
      this.$axios.get('meiduo01/mnewmanage/?cpage='+i)
      .then(res=>{
        this.news =res.data.list
        this.newtpage =res.data.tpage
      })
    },
    get_advertising(i){
      this.$axios.get('meiduo01/madvertisingmanage/?cpage='+i)
        .then(res=>{
          this.advertising =res.data.list
          this.ggtpage = res.data.tpage
        })
    }
  },
  mounted() {
    this.get_new(1)
    this.get_advertising(1)
  }

}
</script>

<style scoped>

</style>
